﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Xqsys.DAL
{
    public class NewsType
    {
        /// <summary>
        /// 增加新闻类型
        /// </summary>
        /// <param name="newsType"></param>
        /// <returns>bool 成功与否</returns>
        public bool AddNewsType(MODEL.NewsType newsType)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@typeID",newsType.TypeID),
                new SqlParameter("@name",newsType.Name),
                new SqlParameter("@introduction",newsType.Introduction)
            };
            return COM.SqlHelper.ExecuteNonQuery("sp_AddNewsType",param);
        }
        /// <summary>
        /// 删除新闻类型
        /// </summary>
        /// <param name="newstype"></param>
        /// <returns>bool</returns>
        public bool DeleteNewsType(MODEL.NewsType newstype)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@typeID",newstype.TypeID)
            };
            if ((int)COM.SqlHelper.ExecuteScalar("sp_DelectNewsType", param) == 0)
                return true;
            else
                return false;
        }
    }
}
